/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ajustes.db;

/**
 *
 * @author Jose Carlos Palma
 */
public class DivisionPermiso {
    private Division division;
    private String db;
    private String ip;
    private String port;
    
    public DivisionPermiso(Division division, String db, String ip, String port){
        this.division = division;
        this.db = db;
        this.ip = ip;
        this.port = port;
    }

    /**
     * @return the division
     */
    public Division getDivision() {
        return division;
    }

    /**
     * @param division the division to set
     */
    public void setDivision(Division division) {
        this.division = division;
    }

    /**
     * @return the db
     */
    public String getDb() {
        return db;
    }

    /**
     * @param db the db to set
     */
    public void setDb(String db) {
        this.db = db;
    }

    /**
     * @return the ip
     */
    public String getIp() {
        return ip;
    }

    /**
     * @param ip the ip to set
     */
    public void setIp(String ip) {
        this.ip = ip;
    }

    /**
     * @return the port
     */
    public String getPort() {
        return port;
    }

    /**
     * @param port the port to set
     */
    public void setPort(String port) {
        this.port = port;
    }
    
    @Override
    public boolean equals(Object obj) {
        
        //por referencia (Reflexivo)
        if (this == obj)
            return true;
        
        //por objeto nulo (No Nulo)
        if (obj == null)
            return false;
        
        //
        if ( !(obj instanceof DivisionPermiso))
            return false;
        
        
        DivisionPermiso tmp = (DivisionPermiso)obj;
        return getDivision().equals(tmp.getDivision());
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 23 * hash + (this.division != null ? this.division.hashCode() : 0);
        hash = 23 * hash + (this.db != null ? this.db.hashCode() : 0);
        return hash;
    }

    @Override
    public String toString(){
        return division.getNombre();
    }
}
